package net.toby200.canalbuddy.notices.model;


import android.os.Parcel;
import android.os.Parcelable;

public class Location implements Parcelable {
	double lat;
	double lng;

	public Location() {
	}
	
	public Location(double lat, double lng) {
		super();
		this.lat = lat;
		this.lng = lng;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("(").append(lat).append(", ").append(lng).append(")");
		return builder.toString();
	}

	public double getLat() {
		return lat;
	}

	public double getLng() {
		return lng;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(lat);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(lng);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Location other = (Location) obj;
		if (Double.doubleToLongBits(lat) != Double.doubleToLongBits(other.lat))
			return false;
		if (Double.doubleToLongBits(lng) != Double.doubleToLongBits(other.lng))
			return false;
		return true;
	}



    @Override
    public int describeContents() {
        return 0;
    }

    public Location(Parcel p) {
        lat = p.readDouble();
        lng = p.readDouble();
    }

    @Override
    public void writeToParcel(Parcel p, int flags) {
        p.writeDouble(lat);
        p.writeDouble(lng);
    }

    public static final Parcelable.Creator<Location> CREATOR = new Parcelable.Creator<Location>() {

        @Override
        public Location createFromParcel(Parcel source) {
            return new Location(source);
        }

        @Override
        public Location[] newArray(int size) {
            return new Location[size];
        }
    };

	
}
